package class02;

import java.util.regex.Matcher;

/**
 * @author Gong Cheng
 * @date 2021/2/25 4:41 下午
 **/
public class Code08_GetMax {

    // 求arr最大值
    public static int getMax(int[] arr){
        return process(arr, 0, arr.length-1);
    }

    public static int process(int[] arr,int L,int R){
        if(L == R ){
            return arr[L];
        }
        int mid = L + ((R - L) >>1);
        int leftMax = process(arr, L, mid);
        int rightMax = process(arr,mid + 1 ,R);
        return Math.max(leftMax,rightMax);
    }
}
